package engine.newUi
{
	import engine.data.ModelLocator;
	import engine.data.ViewObject;
	import engine.flag.ResourcesPath;
	import engine.net.messages.CustomToServerFlag;
	import engine.net.mgr.SystemSender;
	import engine.util.FilterUtil;
	
	import flash.display.MovieClip;
	import flash.text.TextFormat;
	
	import newx.com.ResManager;
	import newx.com.config.StaticIni;
	import newx.com.control.NxClip;

	/**
	 *宠物辅助类 
	 * @author liuel
	 * 
	 */	
	public class PetAssistantLogic
	{
		/**
		 *未启用 
		 */		
		public static const NormalWait	: String = "场景待机开始";
		/**
		 *启用 
		 */		
		public static const Wait			: String = "大待机开始";
		/**
		 *高兴开始 
		 */		
		public static const Delight		: String = "高兴开始";
		/**
		 * 0,
		 * 1,白
		 * 2.绿
		 * 3.蓝
		 * 4.紫红
		 * 5.橙黄
		 * 6.黄
		 * 7.浅黄
		 * 8.灰色
		 */		
		protected const COLOR_TABLE	:Array	=	["","#ffffff'>","#1eff00'>","#20BFF8'>","#a335ee'>","#E8912E'>","#e5cc80'>","#ffff00'>","#9d9d9d'>"];
		/**
		 * 0,灰
		 * 1,白
		 * 2.绿
		 * 3.蓝
		 * 4.紫红
		 * 5.橙黄
		 * 6.黄
		 * 7.浅黄
		 */		
		private var CLOR_GRADE:Array = ["0x9d9d9d","0xffffff","0x1eff00","0x20BFF8","0xa335ee","0xE8912E"];
		private static var _self:PetAssistantLogic
		private var  _ui:PetUI;
		/**
		 *格子状态 1启用状态  2 选中状态 3未启用状态 4未开启滑过
		 */		
		private  const	OPEN_STATE:int  =1,
			OVER_STATE:int  =2,
			CLOSE_STATE:int =3,
			CLOSE_OVER_STATE:int =4;
		private var _currpetObj:Object=new Object();
		public static function getInstance():PetAssistantLogic
		{
			if(_self==null)
			{
				_self=new PetAssistantLogic();
			}
			return _self;
		}
		public function PetAssistantLogic()
		{
			_ui = PetUI.getInstance();
		}
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		/**
		 *排序函数 
		 * @param arr
		 * 
		 */		
		public function sort(arr:Array):Array
		{
			arr.sort(byIsVieObjSort);
			
			return arr.concat();
		}
		private function byIsVieObjSort(obj1:Object,obj2:Object):int
		{
			if(obj1 is ViewObject)
			{
				if(obj1 .GetProperties("ConfigID") == ModelLocator.getInstance().scene.Role.GetProperties("FightPet"))
				{
					return -1;
				}
			}
			if(obj2 is ViewObject)
			{
				if(obj2 .GetProperties("ConfigID") == ModelLocator.getInstance().scene.Role.GetProperties("FightPet"))
				{
					return 1;
				}
				
			}
			if(obj1 is ViewObject)
			{
				if(obj1 .GetProperties("ConfigID") == ModelLocator.getInstance().scene.Role.GetProperties("FollowPet"))
				{
					return -1;
				}
				
			}
			if(obj2 is ViewObject)
			{
				if(obj2 .GetProperties("ConfigID") == ModelLocator.getInstance().scene.Role.GetProperties("FollowPet"))
				{
					return 1;
				}
				
			}
			if(obj1 is ViewObject)
			{
				if(obj2 is ViewObject)
				{
					return int(obj1.ObjKey) - int(obj2.ObjKey)
				}
				else
				{
					return -1;
				}
				
			}
			if(obj1 is ViewObject&&!(obj2 is ViewObject))
			{
				return -1;
			}
			if(obj2 is ViewObject&&!(obj1 is ViewObject))
			{
				return 1;
			}
			

			return 0;
		}
		/**
		 * PROPERTYUI 	=0 页签1
		 * FEEFUI 		=0 页签2
		 * TRAININGUI	=0 页签3
		 * IMPARTUI 	=0 页签4
		 */		
		public static const PROPERTYUI:int=0,FEEFUI:int=1,TRAININGUI:int=2,IMPARTUI:int=3;
				
		private var fiflter:TextFormat=new TextFormat();
		/**
		 *品阶 
		 * @param val
		 * 
		 */		
		public function set grade(val:int):void
		{
			val=val==0?1:val;
			if(PetLoic.getInstance().currBindPet.GetProperties("ConfigID") ==21000701 )
			{
				fiflter.color =CLOR_GRADE[val-1]
			}
			else
			{
				fiflter.color =CLOR_GRADE[val]
			}
			switch(_ui.nxtable.selected)
			{
				case PROPERTYUI:
					_ui.A_nameLabel.setTextFormat( fiflter);
					_ui.A_gradeMC.gotoAndStop(val);
					break;
				case FEEFUI:
					_ui.B_petnameLabel.setTextFormat( fiflter);
					break;
				case TRAININGUI:
					_ui.D_nameLable.setTextFormat( fiflter);
					_ui.D_mc4.gotoAndStop(val);
					setintensify(val);
					break;
//				case 3:
//					break;
				case IMPARTUI:
					_ui.E_lnameLab.setTextFormat( fiflter);
					_ui.E_star1.gotoAndStop(val);
					_ui.E_remand1.gotoAndStop(1);
					_ui.E_remand2.gotoAndStop(1);
					_ui.E_remand3.gotoAndStop(1);
					break;
			}
		}

		/////////////////////////////////////////////////////////////////////////////////属性界面/////////////////////////////////////////////////////////////////////////
		
		/**名字**/
		public function set name(name:String):void
		{
			if(name == "")
			{
				StaticIni.getSwfLangStr(PetLoic.getInstance().currBindPet.GetProperties("ConfigID"));
			}else
			{
				_ui.A_nameLabel.htmlText =name;	
			}
		}
		/**等级**/
		public function set leve(val:int):void
		{
			_ui.A_lvLabel.htmlText =val.toString();
			
		}
		/**
		 *成长率 
		 * @param val
		 * 
		 */		
		public function set growProbability(val:Number):void
		{
			_ui.A_developLable.htmlText =StaticIni.getSwfLangStrVar("Pet_Aptitude",[val.toFixed(1)]);
		}
		/**当前经验**/
		public function set exp(val:int):void
		{
			PetLoic.getInstance().currExp=val;
			PetLoic.getInstance().updateShowExp();
		}
		/**升级经验**/
		public function set nextexp(val:int):void
		{
			PetLoic.getInstance().nextExp=val;
			PetLoic.getInstance().updateShowExp();
		}
		/**装备格子开启等级**/
		public function set equipBoxIndex(val:int):void
		{
			val=0;  //装备不开放
			for(var i:int=0;i<_ui.A_equeGroup.col*_ui.A_equeGroup.row;i++)
			{
				var mc:MovieClip = _ui.A_equeGroup.getItemByIndex(i);
				if(i>val-1)
				{
					
					mc.gotoAndStop(CLOSE_STATE);
				}
				else
				{
					mc.gotoAndStop(OPEN_STATE);
				}
			}
		}
		/**战力**/
		public function set fightPower(val:Number):void
		{
			_ui.A_bellipotent.htmlText = StaticIni.getSwfLangStrVar("Pet_Fight_Pow",[val]);
		}
		/**
		 * 生命
		 * @param val
		 * 
		 */		
		public function set petMaxHP(val:Number):void
		{
			_currpetObj["petMaxHP"] = val;
			_ui.A_labbel1.htmlText =setShowStr("Pet_Property_01",_currpetObj["petMaxHP"],_currpetObj["petMaxHPAdd"]);
		}
		/**
		 *普攻 
		 * @param val
		 * 
		 */		
		public function set petPhyDamage(val:Number):void
		{
			_currpetObj["petPhyDamage"]=val;
			_ui.A_labbel5.htmlText =setShowStr("Pet_Property_02",_currpetObj["petPhyDamage"],_currpetObj["petPhyDamageAdd"]);
		}
		/**
		 *普防 
		 * @param val
		 * 
		 */		
		public function set petPhyDef(val:Number):void
		{
			_currpetObj["petPhyDef"] = val;
			_ui.A_labbel7.htmlText =setShowStr("Pet_Property_03",_currpetObj["petPhyDef"],_currpetObj["petPhyDefAdd"]);
		}
		/**
		 *绝攻 
		 * @param val
		 * 
		 */		
		public function set petMagDamage(val:Number):void
		{
			_currpetObj["petMagDamage"] = val;
			_ui.A_labbel6.htmlText =setShowStr("Pet_Property_04",_currpetObj["petMagDamage"],_currpetObj["petMagDamageAdd"]);
		}
		/**
		 *绝防 
		 * @param val
		 * 
		 */		
		public function set petMagDef(val:Number):void
		{
			_currpetObj["petMagDef"] = val;
			_ui.A_labbel8.htmlText =setShowStr("Pet_Property_05",_currpetObj["petMagDef"],_currpetObj["petMagDefAdd"])
		}
		/**
		 * 生命+
		 * @param val
		 * 
		 */		
		public function set petMaxHPAdd(val:Number):void
		{
			_currpetObj["petMaxHPAdd"] = val;
			_ui.A_labbel1.htmlText =setShowStr("Pet_Property_01",_currpetObj["petMaxHP"],_currpetObj["petMaxHPAdd"]);
		}
		/**
		 *普攻 +
		 * @param val
		 * 
		 */		
		public function set petPhyDamageAdd(val:Number):void
		{
			_currpetObj["petPhyDamageAdd"] = val;
			_ui.A_labbel5.htmlText =setShowStr("Pet_Property_02",_currpetObj["petPhyDamage"],_currpetObj["petPhyDamageAdd"]);
		}
		/**
		 *普防+
		 * @param val
		 * 
		 */		
		public function set petPhyDefAdd(val:Number):void
		{
			_currpetObj["petPhyDefAdd"]= val;
			_ui.A_labbel7.htmlText =setShowStr("Pet_Property_03",_currpetObj["petPhyDef"],_currpetObj["petPhyDefAdd"]);
		}
		/**
		 *绝攻 +
		 * @param val
		 * 
		 */		
		public function set petMagDamageAdd(val:Number):void
		{
			_currpetObj["petMagDamageAdd"] = val;
			_ui.A_labbel6.htmlText =setShowStr("Pet_Property_04",_currpetObj["petMagDamage"],_currpetObj["petMagDamageAdd"]);
		}
		/**
		 *绝防 +
		 * @param val
		 * 
		 */		
		public function set petMagDefAdd(val:Number):void
		{
			_currpetObj["petMagDefAdd"] = val;
			_ui.A_labbel8.htmlText =setShowStr("Pet_Property_05",_currpetObj["petMagDef"],_currpetObj["petMagDefAdd"])
			
		}
		/////////////////////////////////////////////////////////////////////喂养////////////////////////////////////////////////////////////////////////////////////////////
		/**
		 *喂养界面显示的字符串 
		 * @param strID
		 * @param base
		 * @param next
		 * 
		 */		
		private function setShowStr1(strID:String,base:int,next:int):String
		{
			if(!base)
				base=0;
			if(!next)
				next=0;
			var frist:String = StaticIni.getSwfLangStrVar(strID,[base]);
			var str:String   = link_color(frist,1) +initStr(base)+ link_color("   →   ",1) +link_color(next.toString(),2);
			return str;
		}
		/**
		 *名字 
		 * @param name
		 * 
		 */		
		public function set petName1(name:String):void
		{
			_ui.B_petnameLabel.htmlText =name;
		}
		/**
		 *设置宠物头像 
		 * 
		 */		
		public function set model1(val:int):void
		{	
			var model:int=PetLoic.getInstance().currPetisSelf?val:49330100;
			_ui.B_picMC.scaleX=_ui.B_picMC.scaleY=0.6;
			_ui.B_picMC.source = ResourcesPath.getHeadPic(model);
		}
		/**等级**/
		public function set level1(val:int):void
		{
			_ui.B_petlvLabel.htmlText =setShowStr1("Pet_Property_00",val,val+1);
		}
		/**喜好食物开启数**/
		public function set openFavoFoodNum(val:int):void
		{
//			PetLoic.getInstance().openfoodNum =val+1;
//			PetLoic.getInstance().updatafoodOpen(val+1);
		}
		
		/**喜好食物的最大个数**/
		public function set maxfoodnum(val:int):void
		{
			PetLoic.getInstance().foodMaxNum=val+1;
			if(val+1>0)
			{
				updatafoodMaxNum(val+1);
			}
			
		}
		public function updatafoodMaxNum(num:int):void
		{
			var len:int=_ui.B_vieGroup.col*_ui.B_vieGroup.row;
			var _itemMc:MovieClip;
			for(var i:int=0;i<len;i++)
			{
				_itemMc=_ui.B_vieGroup.getItemByIndex(i);
				if(i+1<=num)
				{
					_itemMc.visible=true;
				}
				else
				{
					_itemMc.visible=false;
				}
			}
		}
		
		/**喜好食物**/
		public function set favofood(name:String):void
		{
			//			PetLoic.getInstance().foodArr=[];
			//			PetLoic.getInstance().foodArr.push("48001069")
			var food:Array=name.split(",");
			var arr:Array=[];
			arr.push({ConfigID:"48001069",index:0});
			var obj:Object;
			var index:int;
			for(var i:String in food)
			{
				if(food[int(i)]!="")
				{
					index =int(i)+1;
					obj=new Object;
					obj["ConfigID"] =food[int(i)];
					obj["index"] = index;
					arr.push(obj);
				}
			}
			PetLoic.getInstance().foodArr = arr;
		}
		/**经验**/
		public function set exp1(val:Number):void
		{
			PetLoic.getInstance().currExp=val;
			PetLoic.getInstance().updateShowExp();
		}
		/**最大经验**/
		public function set maxExp1(val:Number):void
		{
			PetLoic.getInstance().nextExp=val;
			PetLoic.getInstance().updateShowExp();
			
		}
		/**
		 *最大生命 
		 * @param val
		 * 
		 */		
		public function set petMaxHP1(val:Number):void
		{
			_currpetObj["petMaxHP1"]=val;
			_ui.B_labbel2.htmlText =setShowStr1("Pet_Property_01",_currpetObj["petMaxHP1"],_currpetObj["petMaxHPNext1"]);
		}
		public function set petMaxHPNext1(val:Number):void
		{
			_currpetObj["petMaxHPNext1"]=val;
			_ui.B_labbel2.htmlText =setShowStr1("Pet_Property_01",_currpetObj["petMaxHP1"],_currpetObj["petMaxHPNext1"]);
		}
		/**
		 *普攻 
		 * @param val
		 * 
		 */		
		public function set petPhyDamage1(val:Number):void
		{
			_currpetObj["petPhyDamage1"] =val;
			_ui.B_labbel9.htmlText =setShowStr1("Pet_Property_02",_currpetObj["petPhyDamage1"],_currpetObj["petPhyDamageNext1"]);
		}
		/**
		 *普防 
		 * @param val
		 * 
		 */		
		public function set petPhyDef1(val:Number):void
		{
			_currpetObj["petPhyDef1"] =val;
			_ui.B_labbel4.htmlText =setShowStr1("Pet_Property_03",_currpetObj["petPhyDef1"],_currpetObj["petPhyDefNext1"]);
		}
		/**绝攻**/
		public function set petMagDamage1(val:Number):void
		{
			_currpetObj["petMagDamage1"] =val;
			_ui.B_labbel11.htmlText =setShowStr1("Pet_Property_04",_currpetObj["petMagDamage1"],_currpetObj["petMagDamageNext1"]);
		}
		/**绝防**/
		public function set petMagDef1(val:Number):void
		{
			_currpetObj["petMagDef1"] =val;
			_ui.B_labbel13.htmlText =setShowStr1("Pet_Property_05",_currpetObj["petMagDef1"],_currpetObj["petMagDefNext1"]);
		}
		/**
		 *下级普攻 
		 * @param val
		 * 
		 */		
		public function set petPhyDamageNext1(val:Number):void
		{
			_currpetObj["petPhyDamageNext1"] =val;
			_ui.B_labbel9.htmlText =setShowStr1("Pet_Property_02",_currpetObj["petPhyDamage1"],_currpetObj["petPhyDamageNext1"]);
		}
		/**
		 *下级普防 
		 * @param val
		 * 
		 */		
		public function set petPhyDefNext1(val:Number):void
		{
			_currpetObj["petPhyDefNext1"] =val;
			_ui.B_labbel4.htmlText =setShowStr1("Pet_Property_03",_currpetObj["petPhyDef1"],_currpetObj["petPhyDefNext1"]);
		}
		/**下级绝攻**/
		public function set petMagDamageNext1(val:Number):void
		{
			_currpetObj["petMagDamageNext1"] =val;
			_ui.B_labbel11.htmlText =setShowStr1("Pet_Property_04",_currpetObj["petMagDamage1"],_currpetObj["petMagDamageNext1"]);
		}
		/**下级绝防**/
		public function set petMagDefNext1(val:Number):void
		{
			_currpetObj["petMagDefNext1"] =val;
			_ui.B_labbel13.htmlText =setShowStr1("Pet_Property_05",_currpetObj["petMagDef1"],_currpetObj["petMagDefNext1"]);
		}


	
	
		/////////////////////////////////////////////////////////////////////宠物属性绑定函数//////////////////////////////////////////////////////////////////
		protected function link_color(str:String,color:int):String
		{
			if(color < 1 || color >8)
			{
				color	=	1;
			}
			return ("<font color ='"+COLOR_TABLE[color]+str+"</font>");
		}
		/**
		 *显示的信息 
		 * @param strID  字符串ID
		 * @param base    基础值
		 * @param subjoin  附加值
		 * @param ishave   附加值是否加百分号
		 */		
		private function setShowStr(strID:String,base:Number,subjoin:Number,ishave:Boolean=false):String
		{
			if(!subjoin)
				subjoin=0;
			if(!base)
				base=0;
			var str:String;
			var per:String 
			per = ishave?"%":"";
			var fristStr:String =StaticIni.getSwfLangStrVar(strID,[base+subjoin]);
//			str = link_color(fristStr,1)+link_color(" ("+"+"+subjoin.toString()+per+")",2);
			return fristStr;
		}
	
		/////////////////////////////////////////////////////宠物传授////////////////////////////////////////////////////////
		/**模型**/
		public function set model2(val:int):void
		{
			_ui.E_picMC1.scaleX =0.83;
			_ui.E_picMC1.scaleY =0.8;
			_ui.E_picMC1.source = ResourcesPath.getHeadPic(val) ;
		}
		/**等级**/
		public function set level2(val:int):void
		{
			_ui.E_llvLab.htmlText = val.toString();
		}
		/**名字**/
		public function set name2(val:String):void
		{
			_ui.E_lnameLab.htmlText =val;
		}
		
		public function seImpartUI(info:Array):void
		{
			var gradeStr:Array= []
			if(ModelLocator.getInstance().scene.Role.getPlayerLevel()<90)
			{
				_ui.E_remand3.visible =false;
				_ui.E_remand2.visible =false;
				_ui.E_remand1.visible =false;
				_ui.E_info1.htmlText ="";
				_ui.E_info2.htmlText ="";
				_ui.E_info3.htmlText ="";
				if(_ui.nxtable.selected == 3)
					_ui.E_ImpartAdd.visible=true;
				return;
			}
			if(_ui.nxtable.selected == 3)
				_ui.E_ImpartAdd.visible=false;
			if(!info||info.length<5)
			{
				_ui.E_remand3.visible =false;
				_ui.E_remand2.visible =false;
				_ui.E_remand1.visible =false;
				_ui.E_info1.htmlText ="";
				_ui.E_info2.htmlText ="";
				_ui.E_info3.htmlText ="";
				return
			}
			var beImpartGrade:int =info[0];
			var vip:int= ModelLocator.getInstance().scene.Role.getVipLevel();//info[0];
			var grade:int=PetLoic.getInstance().currBindPet.GetProperties("Grade")
			var impart:int = PetLoic.getInstance().currBindPet.GetProperties("Impart")
			var val1:int=info[1];
			var exp:int =info[2];
			var val2:int=info[3];
			var val3:int=info[4];
			var needVip:Array = StaticIni.getIniVar("Pet_Impart_Option_VIP","Option").split(",");
			if(!needVip || needVip.length<3 ||impart!=0 )
			{
				_ui.E_remand3.visible =false;
				_ui.E_remand2.visible =false;
				_ui.E_remand1.visible =false;
				_ui.E_info1.htmlText ="";
				_ui.E_info2.htmlText ="";
				_ui.E_info3.htmlText ="";
				return;
			}
			var gradeDifference:int = grade-beImpartGrade;
			gradeDifference =gradeDifference<0?0:gradeDifference;
			if(vip>=int(needVip[2]))
			{
				switch(gradeDifference)
				{
					case 0:
						_ui.E_info1.htmlText =""; //StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
						_ui.E_info2.htmlText="";
						_ui.E_info3.htmlText="";
						_ui.E_remand1.visible =false;
						_ui.E_remand2.visible =false;
						_ui.E_remand3.visible =false;
						break;
					case 1:
						_ui.E_info1.htmlText ="" ;//StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
						_ui.E_info2.htmlText ="";
						_ui.E_info3.htmlText=StaticIni.getSwfLangStrVar("Pet_Impart_Option3",[val3,StaticIni.getSwfLangStr("Pet_Grade_"+grade)]);
						_ui.E_remand1.visible =false;
						_ui.E_remand2.visible =false;
						_ui.E_remand3.visible =true;
						break;
					default:
						_ui.E_remand1.visible =false;
						_ui.E_remand3.visible =true;
						_ui.E_remand2.visible =true;
						_ui.E_info1.htmlText =""// StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
						_ui.E_info2.htmlText = StaticIni.getSwfLangStrVar("Pet_Impart_Option2",[val2,StaticIni.getSwfLangStr("Pet_Grade_"+(grade-1))]);
						_ui.E_info3.htmlText = StaticIni.getSwfLangStrVar("Pet_Impart_Option3",[val3,StaticIni.getSwfLangStr("Pet_Grade_"+grade)]);
						break;
				}
			}
			else if(vip>=int(needVip[1]))
			{
				_ui.E_remand3.visible =false;
				_ui.E_info3.htmlText="";
				switch(gradeDifference)
				{
					case 0:
					case 1:
						_ui.E_info1.htmlText ="";//StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
						_ui.E_info2.htmlText="";
						_ui.E_remand1.visible =false;
						_ui.E_remand2.visible =false;
						_ui.E_remand3.visible =false;
						break;
					default:
						_ui.E_remand1.visible =false;
						_ui.E_remand2.visible =true;
						_ui.E_info1.htmlText = ""//StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
						_ui.E_info2.htmlText = StaticIni.getSwfLangStrVar("Pet_Impart_Option2",[val2,StaticIni.getSwfLangStr("Pet_Grade_"+(grade-1))]);
						break;
				}
			}
			else if(vip>=int(needVip[0]))
			{
				_ui.E_title.visible=false;
				_ui.E_remand1.visible =false;
				_ui.E_remand3.visible =false;
				_ui.E_remand2.visible =false;
				_ui.E_info1.htmlText =""// StaticIni.getSwfLangStrVar("Pet_Impart_Option1",[val1,exp]);
				_ui.E_info2.htmlText =""
				_ui.E_info3.htmlText ="";
			}
			else
			{
				_ui.E_title.visible=false;
				_ui.E_remand3.visible =false;
				_ui.E_remand2.visible =false;
				_ui.E_remand1.visible =false;
				_ui.E_info1.htmlText ="";
				_ui.E_info2.htmlText =""
				_ui.E_info3.htmlText ="";
			}
		}
		/////////////////////////////////////////////////////驯养//////////////////////////////////////////////////////////////////////////
		/**设置驯养**/
		private function setintensify(grade:int):void
		{
			var currBindobj:ViewObject = PetLoic.getInstance().currBindPet;
			if(currBindobj)
			{
				var petConfigID:int = currBindobj.GetProperties("ConfigID");
				var upgradeStr:String = currBindobj.GetProperties("UpGradeItem")
				var UpGradeItemArr:Array =upgradeStr.split(",");
				var index:int = (grade>=5)?3:(grade-1);
				var itemConfigID:int = UpGradeItemConfigID=UpGradeItemArr[index];
				setuiitem(itemConfigID);
				setuiperpoty(petConfigID,grade);
				var maxGrade:String = StaticIni.getIniVar(petConfigID,"MaxGrade");
				if(grade>=int(maxGrade))
				{
					_ui.D_Item.filters= [FilterUtil.GrayColorFilter];
					_ui.D_btn.enabled = false;
					_ui.D_upgrade.enabled = false;
					_ui.D_cusceLable.htmlText = StaticIni.getSwfLangStr("Pet_Max_Grade");
				}
			}
		}
		private var UpGradeItemConfigID:int;
		/**
		 * 
		 * @param configid  物品ID
		 * 
		 */		
		private function setuiitem(configid:int):void
		{
			_ui.D_Item.data.HandleProperties("ConfigID",configid);
			_ui.D_Item.source =ResManager.newResClass( ResourcesPath.getPropsURL(int(StaticIni.getIniVar(configid,"Photo"))));
			var name:String =StaticIni.getSwfLangStr(StaticIni.getIniVar(configid,"NameID"));
			var color:String= StaticIni.getIniVar(configid,"Color");
			_ui.D_itemLable1.htmlText = link_color(name,int(color));
			_ui.D_cusceLable.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_Per",[StaticIni.getIniVar(configid,"UpGradePer")]);
			_ui.D_btn.data.HandleProperties("date",configid);
			_ui.D_ItemLable2.htmlText = StaticIni.getSwfLangStr("Pet_Grade_UP_Source");
			updateBtnState();
		}
		public function updateBtnState():void
		{
			//宠物完美升阶消耗(增加宠物ID发送)
			if(PetLoic.getInstance().currBindPet != null)
				SystemSender.getInstance().CustomMsg(
					CustomToServerFlag.CLIENT_CUSTOMMSG_UPGRADE_PET_GRADE_PERFECT_CONSUME,
					PetLoic.getInstance().currBindPet.GetProperties("ConfigID"));
			
			var amount:int =PetLoic.getInstance().CeckisHaveFood(UpGradeItemConfigID);
			if(amount==0)
			{	_ui.D_Item.filters= [FilterUtil.GrayColorFilter]
				_ui.D_btn.enabled = false;
				_ui.D_upgrade.enabled = false;
			}
			else
			{
				_ui.D_Item.filters=[];
				_ui.D_btn.enabled = true;
				_ui.D_upgrade.enabled = true;
			}
			var currBindobj:ViewObject = PetLoic.getInstance().currBindPet;
		
		}
		/**
		 * 
		 * @param configid 宠物ID 
		 * @param grade  宠物品阶
		 * 
		 */		
		private function setuiperpoty(configid:int,grade:int):void
		{
			var MaxHPGradeUPArr:Array = StaticIni.getIniVar(configid,"MaxHPGradeUP").split(",")
			var PhyDamageGradeUPArr:Array = StaticIni.getIniVar(configid,"PhyDamageGradeUP").split(",")
			var PhyDefGradeUPArr:Array = StaticIni.getIniVar(configid,"PhyDefGradeUP").split(",")
			var MagDamageGradeUPArr:Array = StaticIni.getIniVar(configid,"MagDamageGradeUP").split(",")
			var MagDefGradeUPArr:Array = StaticIni.getIniVar(configid,"MagDefGradeUP").split(",")
			_ui.D_label14.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_After",[MaxHPGradeUPArr[grade-1]]);
			_ui.D_label15.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_After",[PhyDamageGradeUPArr[grade-1]]);
			_ui.D_label16.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_After",[PhyDefGradeUPArr[grade-1]]);
			_ui.D_label17.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_After",[MagDamageGradeUPArr[grade-1]]);
			_ui.D_label18.htmlText = StaticIni.getSwfLangStrVar("Pet_Grade_UP_After",[MagDefGradeUPArr[grade-1]]);
		}
		/**
		  驯养界面需要显示的字符串 有两种 一种带比较值 一种不带 
		 * @param strID
		 * @param base
		 * @param baseadd
		 * @param next
		 * @param nextadd
		 * @param type
		 * @return 
		 * 
		 */
		private function getStrType(strID:String,base:int,baseadd:int,next:int,nextadd:int,type:int=0,per:Boolean=false):String
		{
			if(!base)
				base=0;
			if(!baseadd)
				baseadd=0;
			if(!next)
				next=0;
			if(!nextadd)
				nextadd=0;
			var fristr:String = StaticIni.getSwfLangStrVar(strID,[base+baseadd]);
			var perStr:String = per?"%":"";
			var str:String = link_color(fristr,1)+initStr(int(base+baseadd))+link_color("→   ",1)+link_color(String(next+nextadd)+perStr,2);
			var add:int =int((next+nextadd)-(base+baseadd));
			add=add>0?add:0;	
			var addStr:String = link_color(" ( +"+add.toString()+" )",2);
			return type==0?str:str+addStr;
		
		}
		private function initStr(val:int):String
		{
			var addlen:int = Math.abs(8-(val.toString().length));
			var str:String="";
			for(var i:int=0; i<addlen;i++)
			{
				 str = str.concat("  ");
			}
			return str;
		}
		public function set model3(val:int):void
		{
			_ui.D_pic.scaleX =0.84;
			_ui.D_pic.scaleY =0.84;
			_ui.D_pic.source = ResourcesPath.getHeadPic(val) ;
		}
		/**名字**/
		public function set petName3(name:String):void
		{
			_ui.D_nameLable.htmlText = name;
		}
		/**设置暴击**/
		private function setPetPhyVaprob():void
		{
			_ui.D_label1.htmlText = getStrType("Pet_Property_12",_currpetObj["petPhyVaProb3"],_currpetObj["petPhyVaProbAdd3"],_currpetObj["petPhyVaProbNext3"],_currpetObj["petPhyVaProbAddNext3"],0,true);
		}
		/**设置韧性**/
		private function setPetPhyVaDefProb():void
		{
			_ui.D_label2.htmlText = getStrType("Pet_Property_13",_currpetObj["petPhyVaDefProb3"],_currpetObj["petPhyVaDefProbAdd3"],_currpetObj["petPhyVaDefProbNext3"],_currpetObj["petPhyVaDefProbAddNext3"],0,true);
		}
		/**设置破击**/
		private function setPetDePhyWardProb():void
		{
			_ui.D_label3.htmlText = getStrType("Pet_Property_09",_currpetObj["petDePhyWardProb3"],_currpetObj["petDePhyWardProbAdd3"],_currpetObj["petDePhyWardProbNext3"],_currpetObj["petDePhyWardProbAddNext3"],0,true);
		}
		/**设置抵挡**/
		private function setPetPhyWardProb():void
		{
			_ui.D_label4.htmlText = getStrType("Pet_Property_08",_currpetObj["petPhyWardProb3"],_currpetObj["petPhyWardProbAdd3"],_currpetObj["petPhyWardProbNext3"],_currpetObj["petPhyWardProbAddNext3"],0,true);
		}
		/**设置命中**/
		private function setPetPhyHitProb():void
		{
			_ui.D_label5.htmlText = getStrType("Pet_Property_07",_currpetObj["petPhyHitProb3"],_currpetObj["petPhyHitProbAdd3"],_currpetObj["petPhyHitProbNext3"],_currpetObj["petPhyHitProbAddNext3"],0,true);
		}
		/**设置闪避**/
		private function setPetPhyDodgeProb():void
		{
			_ui.D_label6.htmlText = getStrType("Pet_Property_06",_currpetObj["petPhyDodgeProb3"],_currpetObj["petPhyDodgeProbAdd3"],_currpetObj["petPhyDodgeProbNext3"],_currpetObj["petPhyDodgeProbAddNext3"],0,true);
		}
		/**设置破招**/
		private function setPetDePhyGuardProb():void
		{
			_ui.D_label7.htmlText = getStrType("Pet_Property_11",_currpetObj["petDePhyGuardProb3"],_currpetObj["petDePhyGuardProbAdd3"],_currpetObj["petDePhyGuardProbNext3"],_currpetObj["petDePhyGuardProbAddNext3"],0,true);
		}
		/**设置招架**/
		private function setPetPhyGuardProb():void
		{
			_ui.D_label8.htmlText = getStrType("Pet_Property_10",_currpetObj["petPhyGuardProb3"],_currpetObj["petPhyGuardProbAdd3"],_currpetObj["petPhyGuardProbNext3"],_currpetObj["petPhyGuardProbAddNext3"],0,true)
		}
		/**暴击基础**/
		public function set petPhyVaProb3(val:Number):void
		{
			_currpetObj["petPhyVaProb3"] =val;
			setPetPhyVaprob();
		}
		/**韧性**/
		public function set petPhyVaDefProb3(val:Number):void
		{
			_currpetObj["petPhyVaDefProb3"] =val;
			setPetPhyVaDefProb();
		}
		/**破击**/
		public function set petDePhyWardProb3(val:Number):void
		{
			_currpetObj["petDePhyWardProb3"] =val;
			setPetDePhyWardProb();
		}
		/**抵挡**/
		public function set petPhyWardProb3(val:Number):void
		{
			_currpetObj["petPhyWardProb3"] =val;
			setPetPhyWardProb();
		}
		/**命中**/
		public function set petPhyHitProb3(val:Number):void
		{
			_currpetObj["petPhyHitProb3"] =val;
			setPetPhyHitProb();
		}
		/**闪避**/
		public function set petPhyDodgeProb3(val:Number):void
		{
			_currpetObj["petPhyDodgeProb3"] =val;
			setPetPhyDodgeProb();
		}
		/**破招**/
		public function set petDePhyGuardProb3(val:Number):void
		{
			_currpetObj["petDePhyGuardProb3"] =val;
			setPetDePhyGuardProb();
		}
		/**招架**/
		public function set petPhyGuardProb3(val:Number):void
		{
			_currpetObj["petPhyGuardProb3"] =val;
			setPetPhyGuardProb();
		}
		/**暴击附加**/
		public function set petPhyVaProbAdd3(val:Number):void
		{
			_currpetObj["petPhyVaProbAdd3"] =val;
			setPetPhyVaprob();
			
		}
		/**韧性附加**/
		public function set petPhyVaDefProbAdd3(val:Number):void
		{
			_currpetObj["petPhyVaDefProbAdd3"] = val;
			setPetPhyVaDefProb();
		}
		/**破击附加**/
		public function set petDePhyWardProbAdd3(val:Number):void
		{
			_currpetObj["petDePhyWardProbAdd3"] = val;
			setPetDePhyWardProb();
		}
		/**抵挡附加**/
		public function set petPhyWardProbAdd3(val:Number):void
		{
			_currpetObj["petPhyWardProbAdd3"] = val;
			setPetPhyWardProb()
		}
		/**命中附加**/
		public function set petPhyHitProbAdd3(val:Number):void
		{
			_currpetObj["petPhyHitProbAdd3"] = val;
			setPetPhyHitProb();
		}
		/**闪避附加**/
		public function set petPhyDodgeProbAdd3(val:Number):void
		{
			_currpetObj["petPhyDodgeProbAdd3"] = val;
			setPetPhyDodgeProb();
		}
		/**破招附加**/
		public function set petDePhyGuardProbAdd3(val:Number):void
		{
			_currpetObj["petDePhyGuardProbAdd3"] = val;
			setPetDePhyGuardProb();
		}
		/**招架附加**/
		public function set petPhyGuardProbAdd3(val:Number):void
		{
			_currpetObj["petPhyGuardProbAdd3"] = val;
			setPetPhyGuardProb();
		}
		/////////
		/**暴击下级基础**/
		public function set petPhyVaProbNext3(val:Number):void
		{
			_currpetObj["petPhyVaProbNext3"] =val;
			setPetPhyVaprob();
		}
		/**韧性下级基础**/
		public function set petPhyVaDefProbNext3(val:Number):void
		{
			_currpetObj["petPhyVaDefProbNext3"] =val;
			setPetPhyVaDefProb();
		}
		/**破击下级基础**/
		public function set  petDePhyWardProbNext3(val:Number):void
		{
			_currpetObj["petDePhyWardProbNext3"] =val;
			setPetDePhyWardProb();
		}
		/**抵挡下级基础**/
		public function set  petPhyWardProbNext3(val:Number):void
		{
			_currpetObj["petPhyWardProbNext3"] =val;
			setPetPhyWardProb();
		}
		/**命中下级基础**/
		public function set petPhyHitProbNext3(val:Number):void
		{
			_currpetObj["petPhyHitProbNext3"] =val;
			setPetPhyHitProb();
		}
		/**闪避下级基础**/
		public function set petPhyDodgeProbNext3(val:Number):void
		{
			_currpetObj["petPhyDodgeProbNext3"] =val;
			setPetPhyDodgeProb();
		}
		/**破招下级基础**/
		public function set petDePhyGuardProbNext3(val:Number):void
		{
			_currpetObj["petDePhyGuardProbNext3"] =val;
			setPetDePhyGuardProb();
		}
		/**招架下级基础**/
		public function set petPhyGuardProbNext3(val:Number):void
		{
			_currpetObj["petPhyGuardProbNext3"] =val;
			setPetPhyGuardProb();
		}
		/**暴击附加下级**/
		public function set petPhyVaProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyVaProbAddNext3"] =val;
			setPetPhyVaprob();			
		}
		/**韧性附加下级**/
		public function set petPhyVaDefProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyVaDefProbAddNext3"] = val;
			setPetPhyVaDefProb();
		}
		/**破击附加下级**/
		public function set petDePhyWardProbAddNext3(val:Number):void
		{
			_currpetObj["petDePhyWardProbAddNext3"] = val;
			setPetDePhyWardProb();
		}
		/**抵挡附加下级**/
		public function set petPhyWardProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyWardProbAddNext3"] = val;
			setPetPhyWardProb();
		}
		/**命中附加**/
		public function set petPhyHitProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyHitProbAddNext3"] = val;
			setPetPhyHitProb();
		}
		/**闪避下级附加**/
		public function set petPhyDodgeProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyDodgeProbAddNext3"] = val;
			setPetPhyDodgeProb();
		}
		/**破招下级附加**/
		public function set petDePhyGuardProbAddNext3(val:Number):void
		{
			_currpetObj["petDePhyGuardProbAddNext3"] = val;
			setPetDePhyGuardProb();
		}
		/**招架下级附加**/
		public function set petPhyGuardProbAddNext3(val:Number):void
		{
			_currpetObj["petPhyGuardProbAddNext3"] = val;
			setPetPhyGuardProb();
		}
		/**设置生命**/
		private function setMaxHP():void
		{
			_ui.D_label9.htmlText =getStrType("Pet_Property_01",_currpetObj["petMaxHP3"],_currpetObj["petMaxHPAdd3"],_currpetObj["petMaxHPNext3"],_currpetObj["petMaxHPAddNext3"],1);
		}
		/**设置普攻**/
		private function setPetPhyDamage():void
		{
			_ui.D_label10.htmlText =getStrType("Pet_Property_02",_currpetObj["petPhyDamage3"],_currpetObj["petPhyDamageAdd3"],_currpetObj["petPhyDamageNext3"],_currpetObj["petPhyDamageAddNext3"],1);
		}
		/**设置普防**/
		private function setPetPhyDef():void
		{
			_ui.D_label11.htmlText =getStrType("Pet_Property_03",_currpetObj["petPhyDef3"],_currpetObj["petPhyDefAdd3"],_currpetObj["petPhyDefNext3"],_currpetObj["petPhyDefAddNext3"],1);
		}
		/**设置绝攻**/
		private function setPetMagDamage():void
		{
			_ui.D_label12.htmlText =getStrType("Pet_Property_04",_currpetObj["petMagDamage3"],_currpetObj["petMagDamageAdd3"],_currpetObj["petMagDamageNext3"],_currpetObj["petMagDamageAddNext3"],1);
		}
		/**设置绝防**/
		private function setPetMagDef():void
		{
			_ui.D_label13.htmlText =getStrType("Pet_Property_05",_currpetObj["petMagDef3"],_currpetObj["petMagDefAdd3"],_currpetObj["petMagDefNext3"],_currpetObj["petMagDefAddNext3"],1);
		}
		/**生命基础**/
		public function set petMaxHP3(val:Number):void
		{
			_currpetObj["petMaxHP3"] = val;
			setMaxHP();
		}
		/**生命附加**/
		public function set petMaxHPAdd3(val:Number):void
		{
			_currpetObj["petMaxHPAdd3"] = val;
			setMaxHP();
		}
		/**生命下级基础**/
		public function set petMaxHPNext3(val:Number):void
		{
			_currpetObj["petMaxHPNext3"] = val;
			setMaxHP();
		}
		/**生命下级附加**/
		public function set petMaxHPAddNext3(val:Number):void
		{
			_currpetObj["petMaxHPAddNext3"] = val;
			setMaxHP();
		}
		/**普攻基础**/
		public function set petPhyDamage3(val:Number):void
		{
			_currpetObj["petPhyDamage3"] =val;
			setPetPhyDamage();
		}
		/**普攻附加**/
		public function set  petPhyDamageAdd3(val:Number):void
		{
			_currpetObj["petPhyDamageAdd3"] =val;
			setPetPhyDamage();
		}
		/**普攻下级基础**/
		public function set  petPhyDamageNext3(val:Number):void
		{
			_currpetObj["petPhyDamageNext3"] =val;
			setPetPhyDamage();
		}
		/**普攻下级附加**/
		public function set  petPhyDamageAddNext3(val:Number):void
		{
			_currpetObj["petPhyDamageAddNext3"] =val;
			setPetPhyDamage();
		}
		/**普防基础**/
		public function set petPhyDef3(val:Number):void
		{
			_currpetObj["petPhyDef3"] =val;
			setPetPhyDef();
		}
		/**普防附加**/
		public function set petPhyDefAdd3(val:Number):void
		{
			_currpetObj["petPhyDefAdd3"] =val;
			setPetPhyDef();
		}
		/**普防下级基础**/
		public function set petPhyDefNext3(val:Number):void
		{
			_currpetObj["petPhyDefNext3"] =val;
			setPetPhyDef();
		}
		/**普防下级附加**/
		public function set petPhyDefAddNext3(val:Number):void
		{
			_currpetObj["petPhyDefAddNext3"] =val;
			setPetPhyDef();
		}
		/**绝攻基础**/
		public function set petMagDamage3(val:Number):void
		{
			_currpetObj["petMagDamage3"] = val;
			setPetMagDamage();
		}
		/**绝攻基附加**/
		public function set petMagDamageAdd3(val:Number):void
		{
			_currpetObj["petMagDamageAdd3"] = val;
			setPetMagDamage();
		}
		/**绝攻下级基础**/
		public function set petMagDamageNext3(val:Number):void
		{
			_currpetObj["petMagDamageNext3"] = val;
			setPetMagDamage();
		}
		/**绝攻下级附加**/
		public function set petMagDamageAddNext3(val:Number):void
		{
			_currpetObj["petMagDamageAddNext3"] = val;
			setPetMagDamage();
		}
		/**绝防基础**/
		public function set petMagDef3(val:Number):void
		{
			_currpetObj["petMagDef3"] = val;
			setPetMagDef();
		}
		/**绝防附加**/
		public function set petMagDefAdd3(val:Number):void
		{
			_currpetObj["petMagDefAdd3"] = val;
			setPetMagDef();
		}
		/**绝防下级基础**/
		public function set petMagDefNext3(val:Number):void
		{
			_currpetObj["petMagDefNext3"] = val;
			setPetMagDef();
		}
		/**绝防下级附加**/
		public function set petMagDefAddNext3(val:Number):void
		{
			_currpetObj["petMagDefAddNext3"] = val;
			setPetMagDef();
		}
		
		//////////////////////////////////////////////////////////////////////////////////////强化/////////////////////////////////////////////////////////////////////
		
		
		private function getMc(index:int):MovieClip
		{
			var mc :MovieClip = _ui.C_viewGroup.getItemByIndex(index);
			return mc;
		}
		/**
		 * 
		 * @param arr   index [lv,per,base,next]
		 * 
		 */		
		private function setInfo(arr:Array):void
		{
			var index:int 	= arr.shift();
			var lv:int		= arr.shift();
			var per:Number	= arr.shift();
			var base:int	= arr.shift();
			var next:int	= arr.shift();
			var mc:MovieClip = getMc(index);
			var coin:String;
			var strID:String;
			switch(index)
			{
				case 0:
					strID 	= "Pet_HP_Level";
					break;
				case 1:
					strID 	= "Pet_PhyDamage_Level";
					break
				case 2:
					strID 	= "Pet_PhyDef_Level";
					break
				case 3:
					strID 	= "Pet_MagDamage_Level";
					break
				case 4:
					strID 	= "Pet_MagDef_Level";
					break
				
			}
			(mc["img"] as NxClip).source = ResManager.newResClass(coin);
			mc["plen_2"].width 	= (mc["plen_1"].width/100)*per;
			mc["txt_5"].htmlText 	= link_color("  "+String(per)+"%",2);
			mc["txt_1"].htmlText 	= "2生命丹"
			mc["txt_2"].htmlText 	= StaticIni.getSwfLangStrVar(strID,[lv,lv+1]);
			mc["txt_3"].htmlText	= StaticIni.getSwfLangStrVar("Pet_PowUP",[base,next,next-base]);
		}
		
		/**生命强化等级**/
		public function set petHPLevel4(val:Number):void
		{
			val=30;
			_currpetObj["petHPLevel4"] = val;
			setInfo([0,_currpetObj["petHPLevel4"],_currpetObj["petHPProbability4"],_currpetObj["petMaxHP4"],_currpetObj["petMaxHPNext4"]])
		}
		/**生命强化成功率**/
		public function set petHPProbability4(val:Number):void
		{
			val=50;
			_currpetObj["petHPProbability4"] = val;
			setInfo([0,_currpetObj["petHPLevel4"],_currpetObj["petHPProbability4"],_currpetObj["petMaxHP4"],_currpetObj["petMaxHPNext4"]])
		}
		/**生命**/
		public function set petMaxHP4(val:Number):void
		{
			_currpetObj["petMaxHP4"] = val;
			setInfo([0,_currpetObj["petHPLevel4"],_currpetObj["petHPProbability4"],_currpetObj["petMaxHP4"],_currpetObj["petMaxHPNext4"]])
		}
		/**下级生命**/
		public function set petMaxHPNext4(val:Number):void
		{
			_currpetObj["petMaxHPNext4"] = val;
			setInfo([0,_currpetObj["petHPLevel4"],_currpetObj["petHPProbability4"],_currpetObj["petMaxHP4"],_currpetObj["petMaxHPNext4"]])
		}
		public function set petPhyDamageLevel4(val:Number):void
		{
			_currpetObj["petPhyDamageLevel4"] = val;
			setInfo([1,_currpetObj["petPhyDamageLevel4"],_currpetObj["petPhyDamageProbability4"],_currpetObj["petPhyDamage4"],_currpetObj["petPhyDamageNext4"]]);
		}
		public function set petPhyDamageProbability4(val:Number):void
		{
			_currpetObj["petPhyDamageProbability4"] = val;
			setInfo([1,_currpetObj["petPhyDamageLevel4"],_currpetObj["petPhyDamageProbability4"],_currpetObj["petPhyDamage4"],_currpetObj["petPhyDamageNext4"]])
		}
		public function set petPhyDamage4(val:Number):void
		{
			_currpetObj["petPhyDamage4"] = val;
			setInfo([1,_currpetObj["petPhyDamageLevel4"],_currpetObj["petPhyDamageProbability4"],_currpetObj["petPhyDamage4"],_currpetObj["petPhyDamageNext4"]])
		}
		public function set petPhyDamageNext4(val:Number):void
		{
			_currpetObj["petPhyDamageNext4"] = val;
			setInfo([1,_currpetObj["petPhyDamageLevel4"],_currpetObj["petPhyDamageProbability4"],_currpetObj["petPhyDamage4"],_currpetObj["petPhyDamageNext4"]])
		}
		
		
		public function set petPhyDefLevel4(val:Number):void
		{
			_currpetObj["petPhyDefLevel4"] = val;
			setInfo([2,_currpetObj["petPhyDefLevel4"],_currpetObj["petPhyDefProbability4"],_currpetObj["petPhyDef4"],_currpetObj["petPhyDefNext4"]])
		}
		public function set petPhyDefProbability4(val:Number):void
		{
			_currpetObj["petPhyDefProbability4"] = val;
			setInfo([2,_currpetObj["petPhyDefLevel4"],_currpetObj["petPhyDefProbability4"],_currpetObj["petPhyDef4"],_currpetObj["petPhyDefNext4"]])
		}
		public function set petPhyDef4(val:Number):void
		{
			_currpetObj["petPhyDef4"] = val;
			setInfo([2,_currpetObj["petPhyDefLevel4"],_currpetObj["petPhyDefProbability4"],_currpetObj["petPhyDef4"],_currpetObj["petPhyDefNext4"]])
		}
		public function set petPhyDefNext4(val:Number):void
		{
			_currpetObj["petPhyDefNext4"] = val;
			setInfo([2,_currpetObj["petPhyDefLevel4"],_currpetObj["petPhyDefProbability4"],_currpetObj["petPhyDef4"],_currpetObj["petPhyDefNext4"]])
		}
		
		public function set petMagDamageLevel4(val:Number):void
		{
			_currpetObj["petMagDamageLevel4"] = val;
			setInfo([3,_currpetObj["petMagDamageLevel4"],_currpetObj["petMagDamageProbability4"],_currpetObj["petMagDamage4"],_currpetObj["petMagDamageNext4"]])
		}
		public function set petMagDamageProbability4(val:Number):void
		{
			_currpetObj["petMagDamageProbability4"] = val;
			setInfo([3,_currpetObj["petMagDamageLevel4"],_currpetObj["petMagDamageProbability4"],_currpetObj["petMagDamage4"],_currpetObj["petMagDamageNext4"]])
		}
		public function set petMagDamage4(val:Number):void
		{
			_currpetObj["petMagDamage4"] = val;
			setInfo([3,_currpetObj["petMagDamageLevel4"],_currpetObj["petMagDamageProbability4"],_currpetObj["petMagDamage4"],_currpetObj["petMagDamageNext4"]])
		}
		public function set petMagDamageNext4(val:Number):void
		{
			_currpetObj["petMagDamageNext4"] = val;
			setInfo([3,_currpetObj["petMagDamageLevel4"],_currpetObj["petMagDamageProbability4"],_currpetObj["petMagDamage4"],_currpetObj["petMagDamageNext4"]])
		}
		
		public function set petMagDefLevel4(val:Number):void
		{
			_currpetObj["petMagDefLevel4"] = val;
			setInfo([4,_currpetObj["petMagDefLevel4"],_currpetObj["petMagDefProbability4"],_currpetObj["petMagDef4"],_currpetObj["petMagDefNext4"]])
		}
		public function set petMagDefProbability4(val:Number):void
		{
			_currpetObj["petMagDefProbability4"] = val;
			setInfo([4,_currpetObj["petMagDefLevel4"],_currpetObj["petMagDefProbability4"],_currpetObj["petMagDef4"],_currpetObj["petMagDefNext4"]])
		}
		public function set petMagDef4(val:Number):void
		{
			_currpetObj["petMagDef4"] = val;
			setInfo([4,_currpetObj["petMagDefLevel4"],_currpetObj["petMagDefProbability4"],_currpetObj["petMagDef4"],_currpetObj["petMagDefNext4"]])
		}
		public function set petMagDefNext4(val:Number):void
		{
			_currpetObj["petMagDefNext4"] = val;
			setInfo([4,_currpetObj["petMagDefLevel4"],_currpetObj["petMagDefProbability4"],_currpetObj["petMagDef4"],_currpetObj["petMagDefNext4"]])
		}
		
	}
}